package com.developer.platform.domain.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.developer.platform.domain.service.ISystemService;
import com.developer.platform.infrastructure.data.mapper.NoticeSystemMapper;
import com.developer.platform.infrastructure.data.mapper.SystemMapper;
import com.developer.platform.infrastructure.data.po.NoticeSystem;
import org.springframework.stereotype.Service;

/**
 * @author ：qiaoliang
 * @date ：2021-01-05
 */
@Service
public class SystemServiceImpl implements ISystemService {

  private final SystemMapper systemMapper;
  private final NoticeSystemMapper noticeSystemMapper;

  public SystemServiceImpl(
      SystemMapper systemMapper,
      NoticeSystemMapper noticeSystemMapper) {
    this.systemMapper = systemMapper;
    this.noticeSystemMapper = noticeSystemMapper;
  }

  @Override
  public void deleteById(long id) {
    LambdaQueryWrapper<NoticeSystem> queryWrapper = new LambdaQueryWrapper<>();
    queryWrapper.eq(NoticeSystem::getSystemId, id);
    noticeSystemMapper.delete(queryWrapper);
    systemMapper.deleteById(id);
  }

}
